package com.ty.day3;

/**
 * Created by IntelliJ IDEA.
 *
 * @author : txy
 * @create : 2023/11/16 9:33
 */
public class Student {
    private String id;
    private String name;
    private String sex;
    private Integer age;

    public Student() {
    }

    public Student(String id, String name, String sex, Integer age) {
        this.id = id;
        this.name = name;
        this.sex = sex;
        this.age = age;
    }


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
    public boolean isAdult(Integer age){
        if (age>=18){
            return true;
        }
        return false;
    }

    @Override
    public String toString() {
        return "Student{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", sex='" + sex + '\'' +
                ", age=" + age +
                '}';
    }
}
class Test{
    public static void main(String[] args) {
        Student student = new Student("20200144050","ty","男",22);
        System.out.println(student);
        System.out.println(student.isAdult(student.getAge()));
        student.setId("123");
        student.setName("阳阳");
        student.setSex("女");
        student.setAge(2);
        System.out.println(student);
    }
}
